import { USER_UPDATE_NAME, USER_UPDATE_AGE } from '../constants'
export default function user(state = { name: 'zs', age: 18 }, action) {
  switch (action.type) {
    case USER_UPDATE_NAME:
      return {
        ...state,
        name: action.payload,
      }
    case USER_UPDATE_AGE:
      return {
        ...state,
        age: state.age + 1,
      }
    default:
      return state
  }
}
